package com.sinosoft.sm.system.resource.service;

import java.util.List;

import com.sinosoft.sm.system.common.utils.StringUtil;
import com.sinosoft.sm.system.resource.entity.ResourceEntity;
import com.sinosoft.sm.system.resource.manager.api.ResourceManager;
import com.sinosoft.sm.system.resource.service.api.ResourceService;

public class ResourceServiceImpl implements ResourceService {

	private ResourceManager resourceManager;
	
	public void setResourceManager(ResourceManager resourceManager) {
		this.resourceManager = resourceManager;
	}

	@Override
	public List<ResourceEntity> getPermissionsByRoles(String[] roleIds) {
		if(roleIds == null){
			return null;
		}
		return resourceManager.getPermissionsByRoles(roleIds);
		
	}

	@Override
	public List<ResourceEntity> getResourceByRoleId(String roleid) {
		if(StringUtil.isBlank(roleid)){
			return null;
		}
		return resourceManager.getResourceByRoleId(roleid);
	}
}
